#include<iostream>
using namespace std;

void print(int arr[],int len);
void select_sort(int arr[],int len);

int main()
{
    int arr[] = {9,8,7,6,5,4,3,2,1,0};
    int len = sizeof(arr)/sizeof(int);

    print(arr, len);
    select_sort(arr, len);
    print(arr, len);

    return 0;
}

void print(int arr[], int len)
{
    for (int i = 0; i < len; ++i)
    {
        cout << arr[i] << " ";
    }
    cout << endl;
}

void select_sort(int arr[],int len)
{
    int minpos = -1;
    for(int i = 0; i < len; i++)
    {
        minpos = i;
        for(int j = i; j < len ;j++)
        {
            if(arr[minpos] > arr[j])
            {
                minpos = j;
            }
        }
        swap(arr[minpos],arr[i]);
    }
}